/* 元素截图插件 - 弹出页面样式 */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #f5f7fa;
  color: #333;
  margin: 0;
  padding: 20px;
  min-height: 100vh;
}

.popup-container {
  width: 100%;
  max-width: 800px;
  min-height: 600px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  margin: 0 auto;
}

.header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px;
  text-align: center;
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header .icon {
  margin-bottom: 0;
}

.header .icon svg {
  width: 32px;
  height: 32px;
  opacity: 0.9;
}

.header h1 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  flex: 1;
  text-align: center;
}

/* 语言选择器样式 */
.language-selector {
  position: relative;
  z-index: 10;
}

.language-select {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  color: white;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 16px;
  padding-right: 32px;
  min-width: 100px;
}

.language-select:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
}

.language-select:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}

.language-select option {
  background: #333;
  color: white;
  padding: 8px;
}

.content {
  padding: 30px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* 状态显示区域 */
.status-section {
  margin-bottom: 20px;
}

.status-card {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: white;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.status-icon {
  font-size: 24px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
}

.status-info h4 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 4px 0;
  opacity: 0.9;
}

.current-mode {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* 配置区域 */
.config-section {
  background: #ffffff;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #e9ecef;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  margin-bottom: 20px;
}

.section-header {
  margin-bottom: 16px;
}

.section-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: #2c3e50;
  margin: 0 0 4px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-desc {
  font-size: 13px;
  color: #6c757d;
  margin: 0;
  line-height: 1.4;
}

/* 模式选择网格 */
.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.mode-card {
  position: relative;
  cursor: pointer;
  border: 2px solid #e9ecef;
  border-radius: 10px;
  padding: 16px;
  transition: all 0.2s ease;
  background: #ffffff;
}

.mode-card:hover {
  border-color: #4f46e5;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
  transform: translateY(-1px);
}

.mode-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mode-card input[type="radio"]:checked + .mode-content {
  color: white;
}

.mode-card input[type="radio"]:checked,
.mode-card.selected {
  border-color: #4f46e5;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

/* 确保选中状态在页面加载时立即生效 */
.mode-card:has(input[type="radio"]:checked) {
  border-color: #4f46e5;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.mode-card:has(input[type="radio"]:checked) .mode-content {
  color: white;
}

.mode-card:has(input[type="radio"]:checked) .mode-icon {
  background: rgba(255, 255, 255, 0.2);
}

.mode-card input[type="radio"]:checked .mode-icon svg {
  fill: white;
}

.mode-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mode-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.mode-card input[type="radio"]:checked + .mode-content .mode-icon {
  background: rgba(255, 255, 255, 0.2);
}

.mode-details {
  flex: 1;
}

.mode-details h4 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 4px 0;
  color: inherit;
}

.mode-details p {
  font-size: 13px;
  margin: 0 0 8px 0;
  opacity: 0.8;
  line-height: 1.4;
}

.mode-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mode-badge.recommended {
  background: #28a745;
  color: white;
}

/* 操作区域 */
.action-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.quick-tips {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 12px;
  border-left: 4px solid #4f46e5;
}

.tip-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.tip-item:last-child {
  margin-bottom: 0;
}

.tip-icon {
  font-size: 14px;
  width: 20px;
  text-align: center;
}

.tip-text {
  font-size: 12px;
  color: #495057;
  line-height: 1.4;
}

.description {
  font-size: 14px;
  color: #666;
  text-align: center;
  line-height: 1.5;
}

.mode-selector {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 16px;
  border: 1px solid #e9ecef;
}

.mode-label {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin-bottom: 12px;
  display: block;
}

.mode-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mode-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  padding: 14px 16px;
  border-radius: 8px;
  border: 2px solid transparent;
  transition: all 0.2s ease;
  background: #ffffff;
  min-width: 180px;
}

.mode-option:hover {
  background: #f0f0f0;
  border-color: #e0e0e0;
}

.mode-option input[type="radio"] {
  margin: 0;
  width: 16px;
  height: 16px;
  accent-color: #4f46e5;
  cursor: pointer;
}

.mode-option input[type="radio"]:checked + .mode-text {
  color: #4f46e5;
  font-weight: 600;
}

.mode-option input[type="radio"]:checked {
  transform: scale(1.1);
}

.mode-option:has(input[type="radio"]:checked) {
  background: #f0f4ff;
  border-color: #4f46e5;
}

.mode-text {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 500;
  color: #333;
  transition: all 0.2s ease;
  flex: 1;
  min-width: 140px;
}

.mode-text svg {
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.mode-option input[type="radio"]:checked + .mode-text svg {
  opacity: 1;
}

.mode-desc {
  font-size: 13px;
  color: #666;
  margin-top: 2px;
  line-height: 1.4;
  display: block;
  width: 100%;
  flex-shrink: 0;
  min-width: 120px;
}

.mode-option input[type="radio"]:checked ~ .mode-desc {
  color: #555;
}

.capture-btn {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.capture-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4);
}

.capture-btn:active {
  transform: translateY(0);
}

.capture-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.capture-btn.capturing {
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
  box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

.capture-btn.capturing:hover {
  box-shadow: 0 6px 16px rgba(255, 107, 107, 0.4);
}

.instructions {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 16px;
  border-left: 4px solid #4f46e5;
}

.instructions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.instructions-header:hover {
  color: #4f46e5;
}

.instructions-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin: 0;
  transition: color 0.2s ease;
}

.instructions-header:hover h3 {
  color: #4f46e5;
}

.toggle-icon {
  transition: transform 0.3s ease;
  color: #666;
}

.instructions-header:hover .toggle-icon {
  color: #4f46e5;
}

.instructions.expanded .toggle-icon {
  transform: rotate(180deg);
}

.instructions-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, margin-top 0.3s ease;
  margin-top: 0;
}

.instructions.expanded .instructions-content {
  max-height: 300px;
  margin-top: 12px;
  overflow-y: auto;
}

.instructions-content ol {
  font-size: 13px;
  color: #666;
  line-height: 1.6;
  padding-left: 16px;
  margin: 0;
}

.instructions-content li {
  margin-bottom: 4px;
}

.status {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.status.ready {
  background: #e8f5e8;
  color: #2d5a2d;
  border: 1px solid #c3e6c3;
}

.status.loading {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
}

.status.capturing {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
  animation: pulse 2s infinite;
}

.status.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.status.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

@keyframes pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
  100% {
    opacity: 1;
  }
}

.footer {
  background: #f8f9fa;
  padding: 16px 20px;
  border-top: 1px solid #e9ecef;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.version {
  font-size: 12px;
  color: #6c757d;
  font-weight: 500;
}

.tips {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #6c757d;
}

.tips svg {
  width: 14px;
  height: 14px;
  opacity: 0.7;
}

/* 响应式设计 */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }
  
  .popup-container {
    max-width: 100%;
  }
  
  .content {
    padding: 20px;
  }
  
  .header {
    padding: 20px;
  }
  
  .mode-grid {
    grid-template-columns: 1fr;
  }
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
  transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* 内容区域滚动优化 */
.content {
  scrollbar-width: thin;
  scrollbar-color: #c1c1c1 #f1f1f1;
}

/* 使用说明区域滚动优化 */
.instructions-content {
  scrollbar-width: thin;
  scrollbar-color: #c1c1c1 #f1f1f1;
}

/* 加载动画 */
.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #4f46e5;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 8px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 按钮图标动画 */
.capture-btn svg {
  transition: transform 0.3s ease;
}

.capture-btn:hover svg {
  transform: scale(1.1);
}

.capture-btn.capturing svg {
  animation: rotate 2s linear infinite;
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}